package kuanshu.controller;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import kuanshu.bean.FangDongXinXi;
import kuanshu.mapper.FangDongXinXiMapper;
import kuanshu.util.JsonResult;
import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/fangdongxinxi")
public class FangDongXinXiController {

    @Resource
    private FangDongXinXiMapper fangdongxinxiMapper;

    @PostMapping("/tianjia")
    public JsonResult tianjia(FangDongXinXi fangdongxinxi) {
        fangdongxinxiMapper.tianjia(fangdongxinxi);
        JsonResult result = new JsonResult(true, 200, "success", "");
        return result;
    }

    @RequestMapping("/find")
    public JsonResult yonghuxingming() {
        List<FangDongXinXi> list = fangdongxinxiMapper.find();
        JsonResult jsonResult = new JsonResult(true, 200, list, "");
        return jsonResult;
    }

    @RequestMapping("/a")
    public String a() {
        return "你好世界！";
    }
}